* gen data_fem=(dataset=="Female II")
egen l_fe=group(factory_code line_code)
gen quarter=qofd(date)
gen year=yofd(date)

egen fy=group(factory_code year)
egen fq=group(factory_code quarter)

eststo clear
local O  smv EFF Nw shH 
foreach o of local O{
  
eststo: reghdfe `o' S_sourcing ln_q_b_garment signatory, abs(fq l_fe dd cohort_b data_fem) vce(cluster b_id line) 
  quietly estadd local CTRL ="\scriptsize{B}", replace  
  quietly estadd local est ="OLS", replace  
  quietly estadd local FE ="sq($\tau$),sl,$\tau$", replace  
  quietly estadd local CTRL2 ="Yes", replace    
  quietly estadd scalar  U =  . , replace   
tab dataset if e(sample)==1  

}
*
esttab using "${tables}\TableD2.tex", ///
  title("Buyers' Sourcing and Labor Usage: Alternative Time Horions" \label{LaborUsageHorizon}) ///
  label replace booktabs b(3) se(3) noconstant obslast substitute(\_ _) ///
  drop(ln_q_b_garment signatory _cons ) order() /// 
  stats(FE   r2   N   , fmt( %~#s   2 %12.0fc  )  ///
  labels("FEs"  `"\(R^{2}\)"'  "Obs."  ))   ///
  star(* 0.10 ** 0.05 *** 0.01) ///
  nonotes  